<?php



Route::get('/login', 'LoginController@index');
Route::post('/login', 'LoginController@login');
Route::get('/logout', 'LoginController@logout');
Route::group(['middleware' => ['admin_auth','admin_login']], function(){
    Route::get('/', 'HomeController@index');
    // 系统管理
    Route::group(["permissions"=>['system']], function(){
        // 用户管理
        Route::get('/admins', ['uses'=>'AdminController@index']);
        Route::post('/admins/store', ['uses'=>'AdminController@store']);
        Route::post('/admins/delete',['uses'=>'AdminController@destroy'] );

        // 角色管理
        Route::get('/roles', 'RoleController@index');
        Route::post('/roles/store', 'RoleController@store');
        Route::post('/roles/delete', 'RoleController@destroy');

        // 权限列表
        Route::get('/permissions', 'PermissionController@index');

    });

    // 文章管理
    Route::group(["permissions"=>['posts']], function() {
        // 文章管理
        Route::get('/posts', 'PostController@index');
        Route::post('/posts/{post}/status', 'PostController@status');
    });

    // 专题模块
    Route::group(["permissions"=>['topic']], function(){
        Route::resource('topics', '\App\Admin\Controllers\TopicController', ['only' => [
            'index', 'create', 'store', 'destroy'
        ]]);
    });

    // 通知模块
    Route::group(["permissions"=>['notice']], function(){
       Route::resource('notices', 'NoticeController', [
           'only' => ['index', 'store'],
       ]);
    });
});
